package com.ibuonline.b2b.entity;

import java.io.Serializable;

public class BaseIpRegion implements Serializable {

	private static final long serialVersionUID = 8736522809879105920L;

	//fields
	private java.lang.String ip1;
	private java.lang.String ip2;
	private java.lang.String country;
	private java.lang.String province;
	private java.lang.String city;
	private java.lang.String address;
	private java.lang.Long num1;
	private java.lang.Long num2;
	private java.lang.Long diff;
	private java.lang.String countryCode;
	private java.lang.String areaCode;

	//default constructor
	public BaseIpRegion() {
	}

	//constructor with arguments
	public BaseIpRegion(java.lang.Long num1, java.lang.Long num2) {
		this.num1 = num1;
		this.num2 = num2;
	}

	//getter
	public java.lang.String getIp1() {
		return ip1;
	}
	public java.lang.String getIp2() {
		return ip2;
	}
	public java.lang.String getCountry() {
		return country;
	}
	public java.lang.String getProvince() {
		return province;
	}
	public java.lang.String getCity() {
		return city;
	}
	public java.lang.String getAddress() {
		return address;
	}
	public java.lang.Long getNum1() {
		return num1;
	}
	public java.lang.Long getNum2() {
		return num2;
	}
	public java.lang.Long getDiff() {
		return diff;
	}
	public java.lang.String getCountryCode() {
		return countryCode;
	}
	public java.lang.String getAreaCode() {
		return areaCode;
	}

	//setter
	public void setIp1(java.lang.String ip1) {
		this.ip1 = ip1;
	}
	public void setIp2(java.lang.String ip2) {
		this.ip2 = ip2;
	}
	public void setCountry(java.lang.String country) {
		this.country = country;
	}
	public void setProvince(java.lang.String province) {
		this.province = province;
	}
	public void setCity(java.lang.String city) {
		this.city = city;
	}
	public void setAddress(java.lang.String address) {
		this.address = address;
	}
	public void setNum1(java.lang.Long num1) {
		this.num1 = num1;
	}
	public void setNum2(java.lang.Long num2) {
		this.num2 = num2;
	}
	public void setDiff(java.lang.Long diff) {
		this.diff = diff;
	}
	public void setCountryCode(java.lang.String countryCode) {
		this.countryCode = countryCode;
	}
	public void setAreaCode(java.lang.String areaCode) {
		this.areaCode = areaCode;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof BaseIpRegion))
			return false;

		final BaseIpRegion baseIpRegion = (BaseIpRegion)other;
		if (!this.num1.equals(baseIpRegion.getNum1()) || 
			!this.num2.equals(baseIpRegion.getNum2()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(num1).append(",");
		keys.append(num2).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("BaseIpRegion[")
			.append("ip1=").append(ip1).append(", ")
			.append("ip2=").append(ip2).append(", ")
			.append("country=").append(country).append(", ")
			.append("province=").append(province).append(", ")
			.append("city=").append(city).append(", ")
			.append("address=").append(address).append(", ")
			.append("num1=").append(num1).append(", ")
			.append("num2=").append(num2).append(", ")
			.append("diff=").append(diff).append(", ")
			.append("countryCode=").append(countryCode).append(", ")
			.append("areaCode=").append(areaCode).append("]").toString();
	}
}